home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / BOLEUI32.PAK / COMMON.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.1 KB  |  180 lines

  1. /*
  2.  * COMMON.H
  3.  *
  4.  * Structures and definitions applicable to all OLE 2.0 UI dialogs.
  5.  */
  6. /*
  7.  *      C/C++ Run Time Library - Version 6.5
  8.  *
  9.  *      Copyright (c) 1994 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. #ifndef _COMMON_H_
  15. #define _COMMON_H_
  16.  
  17. #include "ansiapi.h"
  18.  
  19. //Macros to handle control message packing between Win16 and Win32
  20. #ifdef WIN32
  21.  
  22. #ifndef COMMANDPARAMS
  23. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  24.    WORD        wID     = LOWORD(wParam);                           \
  25.    WORD        wCode   = HIWORD(wParam);                           \
  26.    HWND        hWndMsg = (HWND)(UINT)lParam;
  27. #endif  //COMMANDPARAMS
  28.  
  29. #ifndef SendCommand
  30. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  31.          SendMessage(hWnd, WM_COMMAND, MAKELONG(wID, wCode)      \
  32.                   , (LPARAM)hControl)
  33. #endif  //SendCommand
  34.  
  35. #ifndef SendSetSel
  36. #define SendSetSel(hWnd,nStart,nEnd)                               \
  37.             SendMessage(hWnd, EM_SETSEL, (WPARAM) nStart, (LPARAM) nEnd)
  38. #endif  //SendSetSel
  39.  
  40. #else   //Start !WIN32
  41.  
  42. #ifndef COMMANDPARAMS
  43. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  44.    WORD        wID     = LOWORD(wParam);                           \
  45.    WORD        wCode   = HIWORD(lParam);                           \
  46.    HWND        hWndMsg = (HWND)(UINT)lParam;
  47. #endif  //COMMANDPARAMS
  48.  
  49. #ifndef SendCommand
  50. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  51.          SendMessage(hWnd, WM_COMMAND, wID                       \
  52.                   , MAKELONG(hControl, wCode))
  53. #endif  //SendCommand
  54.  
  55. #ifndef SendSetSel
  56. #define SendSetSel(hWnd,nStart,nEnd)                               \
  57.             SendMessage(hWnd, EM_SETSEL, 0, MAKELPARAM(nStart, nEnd))
  58. #endif  //SendSetSel
  59.  
  60. #endif  
  61.  
  62.  
  63.  
  64. //Property labels used to store dialog structures and fonts
  65. #define STRUCTUREPROP       "Structure"
  66. #define FONTPROP            "Font"
  67.  
  68.  
  69. /*
  70.  * Standard structure for all dialogs.  This commonality lets us make
  71.  * a single piece of code that will validate this entire structure and
  72.  * perform any necessary initialization.
  73.  */
  74. typedef struct tagOLEUISTANDARD
  75.    {
  76.    //These IN fields are standard across all OLEUI dialog functions.
  77.    DWORD           cbStruct;       //Structure Size
  78.    DWORD           dwFlags;        //IN-OUT:  Flags
  79.    HWND            hWndOwner;      //Owning window
  80.    LPCOLESTR       lpszCaption;    //Dialog caption bar contents
  81.    LPFNOLEUIHOOK   lpfnHook;       //Hook callback
  82.    LPARAM          lCustData;      //Custom data to pass to hook
  83.    HINSTANCE       hInstance;      //Instance for customized template name
  84.    LPCOLESTR       lpszTemplate;   //Customized template name
  85.    HRSRC           hResource;      //Customized template handle
  86.  
  87.    DWORD           dwIBApplication;  //Bolero app ptr for help
  88.    HHOOK           hHook;            //Bolero F1 hook
  89.    HTASK           hTask;            //Bolero task for F1 hook
  90.     } OLEUISTANDARD, *POLEUISTANDARD, FAR *LPOLEUISTANDARD;
  91.  
  92.  
  93. //Function prototypes
  94. //COMMON.C
  95. UINT  WINAPI  UStandardValidation(const LPOLEUISTANDARD, const UINT, const HGLOBAL FAR *);
  96. UINT  WINAPI  UStandardInvocation(DLGPROC, LPOLEUISTANDARD, HGLOBAL, LPCSTR);
  97. LPVOID WINAPI LpvStandardInit(HWND, UINT, BOOL, HFONT FAR *);
  98. LPVOID WINAPI LpvStandardEntry(HWND, UINT, WPARAM, LPARAM, UINT FAR *);
  99. UINT WINAPI   UStandardHook(LPVOID, HWND, UINT, WPARAM, LPARAM);
  100. void WINAPI   StandardCleanup(LPVOID, HWND);
  101. void WINAPI   StandardShowDlgItem(HWND hDlg, int idControl, int nCmdShow);
  102.  
  103. //DRAWICON.C
  104.  
  105. //Structure for label and source extraction from a metafile
  106. typedef struct tagLABELEXTRACT
  107.    {
  108.    LPOLESTR    lpsz;
  109.    UINT        Index;      // index in lpsz (so we can retrieve 2+ lines)
  110.    DWORD       PrevIndex;  // index of last line (so we can mimic word wrap)
  111.  
  112.    union
  113.       {
  114.       UINT    cch;        //Length of label for label extraction
  115.       UINT    iIcon;      //Index of icon in source extraction.
  116.       } u;
  117.  
  118.    //For internal use in enum procs
  119.    BOOL        fFoundIconOnly;
  120.    BOOL        fFoundSource;
  121.    BOOL        fFoundIndex;
  122.    } LABELEXTRACT, FAR * LPLABELEXTRACT;
  123.  
  124.  
  125. //Structure for extracting icons from a metafile (CreateIcon parameters)
  126. typedef struct tagICONEXTRACT
  127.    {
  128.    HICON       hIcon;          //Icon created in the enumeration proc.
  129.  
  130.    /*
  131.     * Since we want to handle multitasking well we have the caller
  132.     * of the enumeration proc instantiate these variables instead of
  133.     * using statics in the enum proc (which would be bad).
  134.     */
  135.    BOOL        fAND;
  136.    HGLOBAL     hMemAND;        //Enumeration proc allocates and copies
  137.    } ICONEXTRACT, FAR * LPICONEXTRACT;
  138.  
  139.  
  140. //Structure to use to pass info to EnumMetafileDraw
  141. typedef struct tagDRAWINFO
  142.    {
  143.    RECT     Rect;
  144.    BOOL     fIconOnly;
  145.    } DRAWINFO, FAR * LPDRAWINFO;
  146.  
  147.  
  148. int CALLBACK EXPORT EnumMetafileIconDraw(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPARAM);
  149. int CALLBACK EXPORT EnumMetafileExtractLabel(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  150. int CALLBACK EXPORT EnumMetafileExtractIcon(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPICONEXTRACT);
  151. int CALLBACK EXPORT EnumMetafileExtractIconSource(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  152.  
  153.  
  154. LPSTR FAR PASCAL PointerToNthField(LPSTR, int, char);
  155.  
  156. //Shared globals:  our instance, registered messages used from all dialogs and clipboard
  157. // formats used by the PasteSpecial dialog
  158. extern HINSTANCE  ghInst;
  159.  
  160. extern UINT       xMsgEndDialog;
  161.  
  162. // extern UINT       uMsgHelp;
  163. // extern UINT       uMsgBrowse;
  164. // extern UINT       uMsgChangeIcon;
  165. // extern UINT       uMsgFileOKString;
  166. // extern UINT       uMsgCloseBusyDlg;
  167.  
  168. // extern UINT       cfObjectDescriptor;
  169. // extern UINT       cfLinkSrcDescriptor;
  170. // extern UINT       cfEmbedSource;
  171. // extern UINT       cfEmbeddedObject;
  172. // extern UINT       cfLinkSource;
  173. // extern UINT       cfOwnerLink;
  174. // extern UINT       cfFileName;
  175.  
  176. //Standard control identifiers
  177. #define ID_NULL                         98
  178.  
  179. #endif //_COMMON_H_
  180.